package com.cn.action;

import com.cn.dao.DepartmentDao;
import com.cn.dao.DoctorDao;
import com.cn.entity.Department;
import com.cn.entity.Doctor;
import com.opensymphony.xwork2.Action;

public class DoctorUpdateAction implements Action{

	Doctor doctor;
	String departmentname;
	
	

	public Doctor getDoctor() {
		return doctor;
	}

	public void setDoctor(Doctor doctor) {
		this.doctor = doctor;
	}

	
	public String getDepartmentname() {
		return departmentname;
	}

	public void setDepartmentname(String departmentname) {
		this.departmentname = departmentname;
	}

	@Override
	public String execute() throws Exception {
		// TODO Auto-generated method stub
		System.out.println(departmentname);
		DepartmentDao ded=new DepartmentDao();
		Department department=ded.scanOne(departmentname);
		doctor.setDepartment(department);
		DoctorDao dd=new DoctorDao();
		dd.update(doctor);
		return "success";
	}
	
	
	
	
	
}
